<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="person_info" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="gotoPage('2AE7FEFE37424C3DAB880B0F3512287C?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
          <el-button @click="gotoPage('E8CD5FF22E6D4A82A9A669C16ECFAE29?'+vueparams+'')" type='danger' size="mini"><i class='fa fa-remove'></i>删除</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 添加联系人 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="12">
                {{person_info.contact_oneorclient}}
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="相关的记录" prop="">
                  {{empty}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="联系人类别" prop="">
                  {{person_info.ptype}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="联系人类型" prop="">
                  {{person_info.psort}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="访问类型" prop="">
                  {{person_info.visit_type}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="英文名" prop="">
                  {{person_info.english_name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名" prop="">
                  {{person_info.person_name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="性别" prop="">
                  {{person_info.person_sex}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="附加名称" prop="">
                  {{person_info.annex_name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="昵称" prop="">
                  {{person_info.nick_name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="出生日期" prop="">
                  {{person_info.person_birthday}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="公司" prop="">
                  {{person_info.firm}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="岗位" prop="">
                  {{person_info.person_station}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="角色" prop="">
                  {{empty}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <div class="form-unit">
            <span class="mvc-title-left"> 电话号码 </span>
          </div>
          <el-table :data="phone_info">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="u_phones('&phones_id='+scope.row.phones_id+'')">设为主要</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_phone('&phones_id='+scope.row.phones_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="description">
            </el-table-column>
            <el-table-column label="号码" prop="p_no">
            </el-table-column>
            <el-table-column label="分机" prop="phones_extension">
            </el-table-column>
            <el-table-column label="电话号码谢绝" prop="">
            </el-table-column>
          </el-table>
          <el-button @click="gotoPage('1EFFF320BB6B4F4B8BA86CBE249662B2?&cpopup=reload'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 电子邮件地址 </span>
          </div>
          <el-table :data="email_info">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="u_email('&email_id='+scope.row.email_id+'')">设为主要</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_email('&email_id='+scope.row.email_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="description">
            </el-table-column>
            <el-table-column label="号码" prop="e_address">
            </el-table-column>
            <el-table-column label="邮件谢绝" prop="">
            </el-table-column>
          </el-table>
          <el-button @click="gotoPage('B3FBC0318A6D442C936D4CB5082254A0?&cpopup=reload'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 即时通讯地址 </span>
          </div>
          <el-table :data="moment_info">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="u_mc('&contact_id='+scope.row.contact_id+'')">设为主要</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_moment('&contact_id='+scope.row.contact_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="mccon">
            </el-table-column>
            <el-table-column label="类型2" prop="mcno">
            </el-table-column>
            <el-table-column label="号码" prop="mc_no">
            </el-table-column>
            <el-table-column label="有无IM请求" prop="">
            </el-table-column>
          </el-table>
          <el-button @click="gotoPage('A947107177EC4F42A699C28A47D67E76?&cpopup=reload'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 文本消息地址 </span>
          </div>
          <el-table :data="text_info">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="u_ta('&text_id='+scope.row.text_id+'')">设为主要</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_text('&text_id='+scope.row.text_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="description">
            </el-table-column>
            <el-table-column label="地址栏" prop="ta_address">
            </el-table-column>
            <el-table-column label="" prop="">
            </el-table-column>
          </el-table>
          <el-button @click="gotoPage('9A48E03A4C8746B69CD2D9F4119CE1EE?&cpopup=reload'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 地址 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="12">
                <el-form-item label="类型" prop="">
                  {{address_info.address_type}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="地址行" prop="">
                  <div style="white-space: pre-wrap;">{{address_info.address_info}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="城市" prop="">
                  {{address_info.address_city}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="省" prop="">
                  {{address_info.address_province}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="邮政编码" prop="">
                  {{address_info.address_postcode}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="国家" prop="">
                  {{address_info.address_nation}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="纬度" prop="">
                  {{address_info.address_latitude}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="经度" prop="">
                  {{address_info.address_longitude}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <div class="form-unit">
            <span class="mvc-title-left"> 额外明细 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="12">
                <el-form-item label="备注" prop="">
                  {{person_info.remark}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-button @click="gotoPage('2AE7FEFE37424C3DAB880B0F3512287C?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
          <el-button @click="gotoPage('E8CD5FF22E6D4A82A9A669C16ECFAE29?'+vueparams+'')" type='danger' size="mini"><i class='fa fa-remove'></i>删除</el-button>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'客户联系人'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ContactsDetailed',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        person_info: {
          contact_oneorclient: null,
          ptype: null,
          psort: null,
          visit_type: null,
          english_name: null,
          person_name: null,
          person_sex: null,
          annex_name: null,
          nick_name: null,
          person_birthday: null,
          firm: null,
          person_station: null,
        },
        phone_info: [],
        email_info: [],
        moment_info: [],
        text_info: [],
        address_info: {
          address_type: null,
          address_info: null,
          address_city: null,
          address_province: null,
          address_postcode: null,
          address_nation: null,
          address_latitude: null,
          address_longitude: null,
          remark: null,
        },
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "客户联系人"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/contactsDetailed?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      u_ta(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/u_ta?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      u_mc(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/u_mc?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      u_email(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/u_email?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      u_phones(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/u_phones?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_text(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/d_text?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_moment(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/d_moment?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_email(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/d_email?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_phone(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierContacts/d_phone?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
